<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page import=" com.six.entity.Users" %>
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="layui/css/layui.css" />
<script type="text/javascript" src="layui/layui.js"></script>
</head>
<body>
	<jsp:include page="/header"></jsp:include>
	<!--=====================
    Breadcrumb Aera Start
    =========================-->
	<div class="breadcrumbs_area">
		<div class="container">
			<div class="row">
				<div class="col-12">
					<div class="breadcrumb_content">
						<ul>
							<li>
								<h1>
									<a href="indexTwo">首页</a>
								</h1>
							</li>
							<li>我的账户</li>
						</ul>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!--=====================
    Breadcrumb Aera End
    =========================-->

	<!--======================
    My Account area Start
    ==========================-->
    <%
                        HttpSession s=request.getSession();
                        if(s.getAttribute("users_session")==null){
                        	response.sendRedirect(request.getContextPath()+"/login.jsp");
                        }else{
                        	Users u=(Users)s.getAttribute("users_session");
                        %>
	<div class="my-account-area mt-50">
		<div class="container">
			<div class="row">
				<div class="col-12 col-sm-12 col-md-12 col-lg-2">
					<ul class="nav flex-column dashboard-list mb-20 role="tablist">
						<li><a class="nav-link" data-toggle="tab" href="#nofahuo">待发货</a></li>
						<li><a class="nav-link" data-toggle="tab" href="#fahuo">待收货</a></li>
						<li><a class="nav-link active show" data-toggle="tab"
							href="#orders">所有订单</a></li>
						<li><a class="nav-link" data-toggle="tab" href="#address">地址</a></li>
						<li><a class="nav-link" data-toggle="tab"
							href="#account-details">账户详细资料</a></li>
						<li><a class="nav-link" data-toggle="tab"
							href="#updatepass">修改密码</a></li>
						<li><a class="nav-link" href="logout">登出</a></li>
					</ul>
				</div>
				<div class="col-12 col-sm-12 col-md-12 col-lg-10">
					<!-- Tab panes -->
					<div class="tab-content dashboard-content mb-20">
						<!-- end of tab-pane -->
						<div id="fahuo" class="tab-pane fade">
						<form action="#" class="layui-form" onsubmit="false">
							<h2 class="last-title">待收货  </h2>
							<div class="table-responsive">
								<table class="table">
									<thead>
										<tr>
											<th>订单编号</th>
											<th>订购数量</th>
											<th>下单时间</th>
											<th>总价格</th>
											<th>收货地址</th>
											<th>查看订单</th>
											<th>确认收货</th>
										</tr>
									</thead>
									<tbody>
									<c:forEach items="${yes }" var="l">
										<tr>
											<td style="width: 180px">${l.Oid  }</td>
											<td>${l.Osum  }</td>
											<td>${l.Oorder_time }</td>
											<td>${l.OtotalPrice }</td>
											<td hidden="hidden"><input  autocomplete="off" class="layui-input" type="text" lay-verify="required" name="Oid" id="Oid"  value="${l.Oid }"></td>
											<td style="width: 200px">${l.addprovince }，${l.addcity }，${l.adddistinct }，${l.Uharvest_people }（收），联系电话：${l.Uconsignee }</td>
											<td><a href="detail?Oid=${l.Oid }"><i class="layui-icon" style="font-size: 15px; color: #1E9FFF;">查看</i> </a></td>
											<td class="product-cart"><a href="orders_detail_update?Did=${l.Did }&Oid=${l.Oid}"><i class="layui-icon" style="font-size: 15px; color: #1E9FFF;">确认收货</i> </a></td>
										</tr>
									</c:forEach>
									</tbody>
								</table>
							</div>
						</form>
						</div>
						<!-- end of tab-pane -->
						<!-- end of tab-pane -->
						<div id="nofahuo" class="tab-pane fade">
						<form action="#" class="layui-form" onsubmit="false">
							<h2 class="last-title">待发货  </h2>
							<div class="table-responsive">
								<table class="table">
									<thead>
										<tr>
											<th>订单编号</th>
											<th>订购数量</th>
											<th>下单时间</th>
											<th>总价格</th>
											<th>收货地址</th>
											<th>查看订单</th>
										</tr>
									</thead>
									<tbody>
									<c:forEach items="${no }" var="l">
										<tr>
											<td style="width: 180px">${l.Oid  }</td>
											<td>${l.Osum  }</td>
											<td>${l.Oorder_time }</td>
											<td>${l.OtotalPrice }</td>
											<td hidden="hidden"><input  autocomplete="off" class="layui-input" type="text" lay-verify="required" name="Oid" id="Oid"  value="${l.Oid }"></td>
											<td style="width: 300px">${l.addprovince }，${l.addcity }，${l.adddistinct }，${l.Uharvest_people }（收），联系电话：${l.Uconsignee }</td>
											<td><a href="detail?Oid=${l.Oid }"><i class="layui-icon" style="font-size: 15px; color: #1E9FFF;">查看</i> </a></td>
										</tr>
									</c:forEach>
									</tbody>
								</table>
							</div>
						</form>
						</div>
						<!-- end of tab-pane -->
						<div id="orders" class="tab-pane fade active show">
						<form action="#" class="layui-form" onsubmit="false">
							<h3 class="last-title">所有订单</h3>
							<div class="table-responsive">
								<table class="table">
									<thead>
										<tr>
											<th>订单编号</th>
											<th>订购数量</th>
											<th>下单时间</th>
											<th>状态</th>
											<th>总价格</th>
											<th>查看订单</th>
											<th>操作</th>
										</tr>
									</thead>
									<tbody>
									<c:forEach items="${logingetalldetail }" var="l">
										<tr>
											<td style="width: 180px">${l.Oid  }</td>
											<td>${l.Osum  }</td>
											<td>${l.Oorder_time }</td>
											<td>${l.Ostate }</td>
											<td>${l.OtotalPrice }</td>
											<td hidden="hidden"><input  autocomplete="off" class="layui-input" type="text" lay-verify="required" name="Oid" id="Oid"  value="${l.Oid }"></td>
											<td><a href="detail?Oid=${l.Oid }"><i class="layui-icon" style="font-size: 15px; color: #1E9FFF;">查看</i> </a></td>
											<td><a href="orders_del?Oid=${l.Oid }"><i class="fa fa-trash-o"></i></a></td>
										</tr>
									</c:forEach>
									</tbody>
								</table>
							</div>
							</form>
						</div>
						<!-- end of tab-pane -->
						<div id="address" class="tab-pane fade">
						<form action="#" class="layui-form" onsubmit="false">
							<h4 class="last-title">订单地址  <a class="btn btn-secondary" href="#"  id="add">添加</a></h4>
							<div class="table-responsive">
								<table class="table">
									<thead>
										<tr>
											<th>省</th>
											<th>市</th>
											<th>区</th>
											<th>详细地址</th>
											<th>操作</th>
										</tr>
									</thead>
									<tbody>
									<c:forEach items="${logingetalladdress }" var="l">
										<tr>
											<td>${l.addprovince }</td>
											<td>${l.addcity }</td>
											<td>${l.adddistinct }</td>
											<td>${l.addprovince }，${l.addcity }，${l.adddistinct }</td>
											<td hidden="hidden"><input  autocomplete="off" class="layui-input" type="text" lay-verify="required" name="addid" id="addid"  value="${l.addid }"></td>
											<td hidden="hidden"><input  autocomplete="off" class="layui-input" type="text" lay-verify="required" name="addprovince" id="addprovince"  value="${l.addprovince }"></td>
											<td hidden="hidden"><input  autocomplete="off" class="layui-input" type="text" lay-verify="required" name="adddistinct" id="adddistinct"  value="${l.adddistinct }"></td>
											<td hidden="hidden"><input  autocomplete="off" class="layui-input" type="text" lay-verify="required" name="addcity" id="addcity"  value="${l.addcity }"></td>
											<td hidden="hidden"><input  autocomplete="off" class="layui-input" type="text" lay-verify="required" name="Uharvest_people" id="Uharvest_people"  value="${l.Uharvest_people }"></td>
											<td hidden="hidden"><input  autocomplete="off" class="layui-input" type="text" lay-verify="required" name="Uconsignee" id="Uconsignee"  value="${l.Uconsignee }"></td>
											<td><a href="address_del?addid=${l.addid }"><i class="fa fa-trash-o"></i></a></td>
											<td><a href="#" id="update" class="btn btn-secondary" onchange="update()">编辑</a></td>
										</tr>
									</c:forEach>
									</tbody>
								</table>
							</div>
						</form>
						</div>
						<!-- end of tab-pane -->
						<div id="account-details" class="tab-pane fade">
							<h3 class="last-title">帐户详细资料</h3>
							<div class="checkout_info">
								<form  action="#" class="layui-form" onsubmit="false">
								<div class="form_group col-12 " hidden="hidden">
										<label class="form-label">ID <span>*</span></label> 
										<input required=""  autocomplete="off" class="layui-input" type="text" lay-verify="required" name="Uid" id="Uid"  value="<%=u.getUid() %>">
									</div>
									<div class="form_group col-12 ">
										<label class="form-label">姓名 <span>*</span></label> 
										<input readonly="readonly" required=""  autocomplete="off" class="layui-input" type="text" lay-verify="required" name="Uname" id="Uname"  value="<%=u.getUname() %>">
									</div>
									<div class="form_group col-12">
										<label class="form-label">联系电话 <span>*</span></label> 
										<input required=""  autocomplete="off" class="layui-input"
									  type="text" lay-verify="required" name="Uphone" id="Uphone" value="<%=u.getUphone()%>">
									</div>
									<div class="form_group col-12">
										<label class="form-label">电子邮箱 <span>*</span></label> <input required=""  autocomplete="off" class="layui-input"
											class="input-form input-login" type="text"  lay-verify="required" name="Uurl" id="Uurl" value="<%=u.getUurl() %>">
									</div>
									<div class="form-row mt-20">
										<input type="submit" class="btn-secondary" lay-submit lay-filter="formDemo" value="编辑">
									</div>
								</form>
							</div>
						</div>
						<!-- end of tab-pane -->
						<!-- end of tab-pane -->
						<div id="updatepass" class="tab-pane fade">
							<h3 class="last-title">修改密码</h3>
							<div class="checkout_info">
								<form  action="pass" class="layui-form" method="post" onsubmit="false">
								<div class="form_group col-12 " hidden="hidden">
										<label class="form-label">ID <span>*</span></label> 
										<input required=""  autocomplete="off" class="layui-input" type="text" lay-verify="required" name="Uid" id="Uid"  value="<%=u.getUid() %>">
									</div>
									<div class="form_group col-12 ">
										<label class="form-label">旧密码 <span>*</span></label> 
										<input  required=""  autocomplete="off" class="layui-input" type="password" lay-verify="required" name="pass" id="pass">
									</div>
									<div class="form_group col-12">
										<label class="form-label">新密码 <span>*</span></label> 
										<input required=""  autocomplete="off" class="layui-input"
									  type="password" lay-verify="required" name="newpass" id="newpass" >
									</div>
									<div class="form_group col-12">
										<label class="form-label">再次确认新密码 <span>*</span></label> <input required=""  autocomplete="off" class="layui-input"
											class="input-form input-login" type="password"  lay-verify="required" name="Upass" id="Upass">
									</div>
									<div class="form-row mt-20">
										<input type="submit" class="btn-secondary" value="编辑"><span>${msg }</span>
									</div>
								</form>
							</div>
						</div>
						<!-- end of tab-pane -->
					</div>
				</div>
			</div>
		</div>
	</div>
	<!--======================
    My Account area End
    ==========================-->
    <%} %> 
	<!--===================
     footer area start 
    ===================-->
	<footer class="mt-30">
		<!-- Newslatter area start -->
		<div class="newsletter-group">
			<div class="container">
				<div class="row align-items-center">
					<div class="col-lg-6 col-12">
						<div class="newsletter-inner d-flex align-items-center">
							<i class="fa fa-envelope-open-o"></i>
							<div class="newsletter-title">
								<h1 class="sign-title">注册我们的通讯</h1>
								<p>获取有关我们最新商店和特惠信息的电子邮件更新。</p>
							</div>
						</div>
					</div>
					<div class="col-lg-6 col-12">
						<div class="newsletter-box">
							<form id="mc-form" class="mc-form">
								<input type="email" id="mc-email" class="email-box"
									placeholder="输入你的电子邮箱" name="EMAIL">
								<button id="mc-submit" class="newsletter-btn" type="submit">订阅</button>
							</form>
							<!-- mailchimp-alerts Start -->
							<div class="mailchimp-alerts text-centre">
								<div class="mailchimp-submitting"></div>
								<!-- mailchimp-submitting end -->
								<div class="mailchimp-success text-success"></div>
								<!-- mailchimp-success end -->
								<div class="mailchimp-error text-danger"></div>
								<!-- mailchimp-error end -->
							</div>
							<!-- mailchimp-alerts end -->
						</div>
					</div>
				</div>
			</div>
		</div>
		<!-- Newslatter area End -->
		<!-- Footer Top Start -->
		<div class="footer-top mt-50 mb-40">
			<div class="container">
				<div class="row">
					<div class="col-lg-4">
						<div class="footer-single-widget">
							<div class="footer-logo mb-40">
								<a href="index"><img
									src="assets/images/logo/pos-circle-logo.jpg" alt=""></a>
							</div>
							<div class="widget-body">
								<div class="widget-address mt-30 mb-20">
									<p>
										<strong>地址:</strong>新乡市，红旗区，新乡职业技术学院
									</p>
									<p>
										<strong>联系电话:</strong> (800) 123 456 - (800) 123 456.
									</p>
									<p>
										<strong>电子邮箱:</strong> support@circleshop.com
									</p>
								</div>
							</div>
						</div>
					</div>
					<div class="col-lg-8">
						<div class="row">
							<div class="col-lg-3 col-md-3 col-6">
								<div class="widgets_container">
									<h6>信息</h6>
									<div class="footer_menu">
										<ul>
											<li><a href="#">隐私政策</a></li>
											<li><a href="#">条款及细则</a></li>
										</ul>
									</div>
								</div>
							</div>
							<div class="col-lg-3 col-md-3 col-6">
								<div class="widgets_container">
									<h6>我的账户</h6>
									<div class="footer_menu">
										<ul>
											<li><a href="#">我的帐户</a></li>
											<li><a href="#">心愿单</a></li>
										</ul>
									</div>
								</div>
							</div>
							<div class="col-lg-3 col-md-3 col-6">
								<div class="widgets_container">
									<h6>快速找到</h6>
									<div class="footer_menu">
										<ul>
											<li><a href="#">历史悠久</a></li>
											<li><a href="#">新闻快报</a></li>
										</ul>
									</div>
								</div>
							</div>
							<div class="col-lg-3 col-md-3 col-6">
								<div class="widgets_container">
									<h6>客户服务</h6>
									<div class="footer_menu">
										<ul>
											<li><a href="#">网站地图</a></li>
											<li><a href="#">联系我们</a></li>
										</ul>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!-- Footer Top End -->
	</footer>
	<!--===================
     footer area end 
    ===================-->


	<!-- Use the minified version files listed below for better performance and remove the files listed above -->
	<script src="assets/js/vendor/vendor.min.js"></script>
	<script src="assets/js/plugins/plugins.min.js"></script>

	<!-- Main JS -->
	<script src="assets/js/main.js"></script>
	<script>
		//Demo
		layui.use('form', function() {
			var form = layui.form;
			var $ = layui.jquery;
			/* 添加按钮 */
			$('#add').on('click', function() {
				layer.open({//打开一个页面
					type : 2,//在当前页面打开一个页面
					area : [ '550px', '600px' ],//页面宽高
					content : 'address-add.jsp',//页面地址
					title : '新增订单地址',//打开页面标题
					end : function() {
						window.location.reload();//当窗口关闭后刷新页面
					}
				});
			});
			/* 编辑按钮 */
			$('#update').on('click', function() {
				layer.open({//打开一个页面
					type : 2,//在当前页面打开一个页面
					area : [ '550px', '600px' ],//页面宽高
					content : 'address-update.jsp',//页面地址
					title : '编辑订单地址',//打开页面标题
					success : function(layero, index) {
						var body = layer.getChildFrame('body', index);
						body.contents().find("#Uconsignee").val($("#Uconsignee").val());
						body.contents().find("#Uharvest_people").val($("#Uharvest_people").val());
						body.contents().find("#addcity").val($("#addcity").val());
						body.contents().find("#adddistinct").val($("#adddistinct").val());
						body.contents().find("#addprovince").val($("#addprovince").val());
						body.contents().find("#addid").val($("#addid").val());
					},
					end : function() {
						window.location.reload();//当窗口关闭后刷新页面
					}
				});
			});
			//监听提交
			form.on('submit(formDemo)', function(data) {
				var d = data.field;//表单中的数据，定义一个对象来接收
				var url = '/shoppingsix/my-account_update';
				$.post(url, d, function(data) {
					if(data.count>0){
						console.log('修改成功');
						layer.msg('修改成功');
					}
				}, "json");
				return false;
			});
			//监听提交修改密码
			form.on('submit(form)', function(data) {
				var d = data.field;//表单中的数据，定义一个对象来接收
				var url = '/shoppingsix/pass';
				$.post(url, d, function(data) {
					if(data.count>0){
						console.log('修改成功');
						layer.msg('修改成功');
						window.location.href = "login.jsp";
					}
				}, "json");
				return false;
			});
		});
	</script>
</body>
</html>